package com.cityeye.form;

import com.cityeye.dao.IssueTypeDao;
import com.cityeye.entity.Issuetype;
import com.cityeye.entity.Subissuetype;

public class SubissuetypeForm extends AbsEntityForm<Subissuetype> {

	// Fields

	private Integer id;
	private Integer issuetypeId;
	private String name;
	private Integer point=0;
	private Integer valid=1;

	// Constructors

	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getIssuetypeId() {
		return this.issuetypeId;
	}

	public void setIssuetypeId(Integer issuetype) {
		this.issuetypeId = issuetype;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getPoint() {
		return this.point;
	}

	public void setPoint(Integer point) {
		this.point = point;
	}

	public Integer getValid() {
		return this.valid;
	}

	public void setValid(Integer valid) {
		this.valid = valid;
	}

	public Subissuetype toEntity(){
		Subissuetype subIssue = new Subissuetype();
		subIssue.setId(getId());
		subIssue.setName(getName());		
		subIssue.setPoint(getPoint());
		subIssue.setValid(getValid());
		
		Issuetype issue=null;
		if(getIssuetypeId()!=null){
			IssueTypeDao deptDao = new IssueTypeDao();		
			issue = deptDao.findById(getIssuetypeId());
		}
		
		subIssue.setIssuetype(issue);		
		
		return subIssue;
	}	

}